<?php
/* 
 * Amnesia is Copyright (c) 2010 Mark Russell
 * 
 * Contact: info@amnesia-app.com	
 * 
 * This file is part of Amnesia.
 * 
 * Amnesia is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Amnesia is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Amnesia. If not, see <http://www.gnu.org/licenses/>.
 *
 */

include '../../db/db.php';

$id = mysql_real_escape_string ($_POST[id]);

// Select the example data from DB
$query = 'SELECT * FROM `category` ORDER BY `category_id` ASC';

if(!($result = @ mysql_query ($query, $con)))
	showerror();

$xml = "";

while($array = mysql_fetch_array($result)) {

	$category_id = $array['category_id'];
	$name = $array['name'];
	$item_table = $array['item_table'];
	$icon_path = $array['icon_path'];
	
	$xml .= "<category>";
	$xml .= "<category_id>$category_id</category_id>";
	$xml .= "<name>$name</name>";
	$xml .= "<item_table>$item_table</item_table>";
	$xml .= "<icon_path>$icon_path</icon_path>";
	$xml .= "</category>";
 
}

header('Content-Type: application/xml; charset=ISO-8859-1');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
echo "<categories>";
echo $xml;
echo "</categories>";

mysql_close($con);
?>
